FROM node:14 as build-stage

WORKDIR /app

COPY frontend/package*.json ./

RUN npm config set registry https://registry.npmmirror.com && \
    npm install

COPY frontend/ .

RUN npm run build

FROM nginx:stable-alpine as production-stage

COPY --from=build-stage /app/dist /usr/share/nginx/html

COPY frontend/nginx.conf /etc/nginx/nginx.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"] 